<?php
include_once ('model/Student/class-student.php');
include_once ('model/Student/class-courseregistration.php');
include_once ('control/student-proc.php');
include_once ('model/currentSemester.php');
session_start();

$student;
if(!isset($_SESSION["user"])){
    header("location:http:/educational/index.php");
} else {
	$student = $_SESSION["user"];
	include_once ('model/connect.php');
}
?>
<!DOCTYPE html>
<html xml:lang="EN" lang="EN" dir="ltr">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Educational</title>
<?php include("header-srcipt.php");?>
</head>
<body>
<div class="wrapper col0">
  <div id="topbar">
  	<div id="loginpanel">
      <ul>
        <li class="left">Welcome <?php echo($student->getStudentName());?> </li>
      </ul>
    </div>
    <br class="clear" />
  </div>
</div>
<!-- ####################################################################################################### -->
<?php include("header-title.php");?>
<!-- ####################################################################################################### -->
<?php include("student-menu-main.php");?>
<!-- ####################################################################################################### -->
<div class="wrapper col4">
  <div id="container">
  <table id="course-list">
  	<thead>
     <tr>
    	<th>Mã môn</th>
        <th>Tên môn</th>
        <th>Trạng thái</th>
        <th>Ngày đăng ký</th>
        <th></th>
      </tr>  
    </thead>
    <?php 
		$temp = new Registrion;
				
		foreach($temp->listRegistaredCourse($student->getStudentId()) as $regs) {
	?>
    <tr>
		<td><?php echo($regs->getCourseId());?></td>
        <td><?php echo(lookupCoursename($regs->getCourseId()));?></td>
        <td><?php echo(translateApprovedCollum($regs->getApproved()));?></td>
        <td><?php echo($regs->getRegistrionDate());?></td>
        <td>
        	<?php if ($resigerMode && strtolower($regs->getApproved()) != 'approved') {?>
        	<form method="post" action="control/student-del-course.php">
            	<input type="hidden" value="<?php echo $student->getStudentId();?>" name="studentid" />
                <input type="hidden" value="<?php echo $regs->getCourseId();?>" name="courseid" />
                <input type="submit" value="Xóa" />
            </form>
            <?php } else {?>
                <button disabled="true">Xóa</button>
            <?php }?>
        </td>
    </tr>
	<?php }?>
   </table>
  </div>
</div>
<!-- ####################################################################################################### -->
<?php include("footer.php");?>
</body>
</html>
